//
//  ResilienceBuilding.swift
//  HIextractLicve
//
//  Created by HIextractLicve on 2024/12/10.
//

import UIKit

class ResilienceBuilding: UITableViewCell {
    var eachVioViewHTLC:THLCNOrBUTTOn?
    var mindfulnessPageHTL:THLCNPageControll?
    var journeyHTLC:UIView?
    
    let userHeaderHTL = UIImageView.init()
    let usernamhrHTl = UILabel.init()
    let saycontentHTl = UILabel.init()
    
    private let shingcontetnBgroundHTLC = UIView.init()
    
 
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        userHeaderHTL.layer.cornerRadius = 20.xHTL
        userHeaderHTL.layer.masksToBounds = true
        usernamhrHTl.textColor = UIColor(red: 1, green: 1, blue: 1, alpha:  0.7)
        usernamhrHTl.font = UIFont(name: "Trebuchet MS", size: 14)
        
        saycontentHTl.textColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1)
        saycontentHTl.font = UIFont(name: "Trebuchet MS", size: 14)
        saycontentHTl.numberOfLines = 0
        backgroundColor = .clear
        
        shingcontetnBgroundHTLC.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.6)
        shingcontetnBgroundHTLC.layer.cornerRadius = 16.xHTL
        shingcontetnBgroundHTLC.layer.maskedCorners = [.layerMaxXMinYCorner,.layerMinXMaxYCorner,.layerMinXMaxYCorner]
        contentView.addSubview(userHeaderHTL)
        contentView.addSubview(shingcontetnBgroundHTLC)
       
        contentView.addSubview(usernamhrHTl)
        contentView.addSubview(saycontentHTl)
        if contentView.isHidden == true {
            journeyHTLC?.alpha = 1
            journeyHTLC?.layer.cornerRadius = 12
        }
        journeyHTLC?.backgroundColor = UIColor(red: 0.06, green: 0.07, blue: 0.07, alpha: 0.01)

        eachVioViewHTLC = THLCNOrBUTTOn.init()
        eachVioViewHTLC?.setTitle("anchors", for: .normal)
        if journeyHTLC != nil {
            journeyHTLC?.addSubview(eachVioViewHTLC ?? THLCNOrBUTTOn.init())
            contentView.addSubview(journeyHTLC!)
        }

        mindfulnessPageHTL = THLCNPageControll()
        mindfulnessPageHTL?.numberOfPages = 1
        mindfulnessPageHTL?.backgroundColor = UIColor(red: 0.06, green: 0.07, blue: 0.07, alpha: 0.01)
        mindfulnessPageHTL?.tintColor = UIColor(red: 0.06, green: 0.07, blue: 0.07, alpha: 0.01)
        mindfulnessPageHTL?.sizeToFit()

        if journeyHTLC != nil {
            journeyHTLC?.addSubview(mindfulnessPageHTL ?? THLCNPageControll.init())
           
        }
        userHeaderHTL.snp.makeConstraints { make in
            make.leading.equalToSuperview().inset(12.xHTL)
            make.width.height.equalTo(40.xHTL)
            make.top.equalToSuperview().offset(10)
            
        }
        
        usernamhrHTl.snp.makeConstraints { make in
            make.top.equalTo(userHeaderHTL).offset(7.xHTL)
            make.leading.equalTo(userHeaderHTL.snp.trailing).offset(23.xHTL)
            make.height.equalTo(16)
            make.width.greaterThanOrEqualTo(60.xHTL)
        }
        
        saycontentHTl.snp.makeConstraints { make in
            make.left.equalTo(usernamhrHTl)
            make.top.equalTo(usernamhrHTl.snp.bottom).offset(6.xHTL)
            make.bottom.equalToSuperview().offset(-17.xHTL)
           
            make.width.lessThanOrEqualTo(250.xHTL)
            make.width.greaterThanOrEqualTo(60.xHTL)
        }
        
        
  
        shingcontetnBgroundHTLC.snp.makeConstraints { make in
            make.left.equalTo(userHeaderHTL.snp.right).offset(11.xHTL)
            make.top.equalTo(userHeaderHTL)
            make.bottom.equalTo(saycontentHTl.snp.bottom).offset(7.xHTL)
            make.right.equalTo(saycontentHTl).offset(15.xHTL)
        }
    }
    
  
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}




class HTLCroomeLiveGiftCell: UITableViewCell {
    
    
    let userHeaderHTL = UIImageView.init()
    let usernamhrHTl = UILabel.init()
    let giftcontentIConHTl = UIImageView.init()
    let giftCountLblHTl = UILabel.init()
    
    private let shingcontetnBgroundHTLC = UIView.init()
    
    
 
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        userHeaderHTL.layer.cornerRadius = 27.xHTL
        userHeaderHTL.layer.masksToBounds = true
        usernamhrHTl.textColor = UIColor(red: 1, green: 1, blue: 1, alpha:1)
        usernamhrHTl.font = UIFont(name: "Trebuchet MS Bold", size: 16)
        giftcontentIConHTl.contentMode = .scaleAspectFit
        
        giftCountLblHTl.textColor = UIColor(red: 1, green: 0.63, blue: 0.22, alpha: 1)
        giftCountLblHTl.font = UIFont(name: "Trebuchet MS Bold Italic", size: 28)
        
//        let bgLayer1 = CAGradientLayer()
//        bgLayer1.colors = [UIColor(red: 0.13, green: 0.15, blue: 0.16, alpha: 0).cgColor, UIColor(red: 0.08, green: 0.09, blue: 0.09, alpha: 0.65).cgColor, UIColor(red: 0.06, green: 0.07, blue: 0.07, alpha: 0.9).cgColor]
//        bgLayer1.locations = [0, 0.5, 1]
//        bgLayer1.frame = CGRect(x: 0, y: 0, width: 287, height: 70)
//        bgLayer1.startPoint = CGPoint(x: 0.97, y: 1)
//        bgLayer1.endPoint = CGPoint(x: 1.06, y: 1.06)
        shingcontetnBgroundHTLC.backgroundColor =  UIColor(red: 0.08, green: 0.09, blue: 0.09, alpha: 0.65)
        
        
        backgroundColor = .clear
  
        
        contentView.addSubview(shingcontetnBgroundHTLC)
        shingcontetnBgroundHTLC.addSubview(userHeaderHTL)
        
       
        shingcontetnBgroundHTLC.addSubview(usernamhrHTl)
        shingcontetnBgroundHTLC.addSubview(giftcontentIConHTl)
        shingcontetnBgroundHTLC.addSubview(giftCountLblHTl)
        
        shingcontetnBgroundHTLC.snp.makeConstraints { make in
            make.left.equalToSuperview()
            make.width.equalTo(287)
            make.height.equalTo(70)
            make.centerY.equalToSuperview()
            make.top.bottom.equalToSuperview().inset(18.xHTL)
        }
        userHeaderHTL.snp.makeConstraints { make in
            make.leading.equalToSuperview().inset(12.xHTL)
            make.width.height.equalTo(54.xHTL)
            make.top.equalToSuperview().offset(10)
            
        }
        
        usernamhrHTl.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.leading.equalTo(userHeaderHTL.snp.trailing).offset(23.xHTL)
            make.height.equalTo(16)
            make.width.greaterThanOrEqualTo(60.xHTL)
        }
        
        giftcontentIConHTl.snp.makeConstraints { make in
            make.left.equalTo(usernamhrHTl.snp.right).offset(8.xHTL)
            make.centerY.equalToSuperview()
            make.width.height.equalTo(62)
        }
        
        
  
        giftCountLblHTl.snp.makeConstraints { make in
            make.left.equalTo(giftcontentIConHTl.snp.right)
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-5)
        }
    }
    
  
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
